package com.sgb.jicai.weight;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.sgb.jicai.R;

/**
 * Time:2021/7/21
 * AUTHOR:F_Q
 * Description: 需方发起和企业专项的进度数据处理
 */
public class DemanderCompanyContentProgress extends RelativeLayout {

    private TextView tvOne;
    private TextView tvTwo;
    private TextView tvThree;
    private ProgressBar progressbar;

    public DemanderCompanyContentProgress(Context context) {
        this(context,null);
    }

    public DemanderCompanyContentProgress(Context context, AttributeSet attrs) {
        this(context, attrs, 0);

    }

    public DemanderCompanyContentProgress(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        // 加载布局
        LayoutInflater.from(context).inflate(R.layout.demander_company_content_progress, this);
        // 获取控件
        progressbar = findViewById(R.id.progressbar);
        tvOne = findViewById(R.id.tv_two);
        tvTwo = findViewById(R.id.tv_three);
        tvThree = findViewById(R.id.tv_three);
    }


    /**
     * 设置progressbar进度
     * @param progress
     */
    public void setProgressbar(int progress) {
        switch (progress){
            case 25:
                tvOne.setBackgroundResource(R.mipmap.under_way);
                tvTwo.setBackgroundResource(R.mipmap.under_un);
                tvThree.setBackgroundResource(R.mipmap.under_un);
                break;
            case 75:
                tvOne.setBackgroundResource(R.mipmap.under_way);
                tvTwo.setBackgroundResource(R.mipmap.under_way);
                tvThree.setBackgroundResource(R.mipmap.under_un);
                break;
            case 100:
                tvOne.setBackgroundResource(R.mipmap.under_way);
                tvTwo.setBackgroundResource(R.mipmap.under_way);
                tvThree.setBackgroundResource(R.mipmap.under_way);
                break;
        }
        progressbar.setProgress(progress);
    }
}
